﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Portal.Core;
using Portal.Cms.Model;
using System.Collections.ObjectModel;
using Portal.Cms.Utility;

namespace Portal.Cms.Bussiness
{
    public class CmsModulePermission:PermissionModuleTemplate
    {
        public override string ServiceId
        {
            get
            {
                return "CmsModulePermission";
            }
        }

        public override string ServiceName
        {
            get
            {
                return "Phân quyền cho các module CMS";
            }
        }

        public override Collection<PermissionItemListCls> GetPermissionItemLists(string SiteId)
        {
            GroupDataCls[] GroupData = CmsUtility.CreateCmsBussinessProcess(SiteId).CreateCmsProcess(SiteId).ReadingGroupDataForPermission(SiteId);
            Collection<PermissionItemListCls> PermissionItemLists = new Collection<PermissionItemListCls> { };
            PermissionItemListCls OPermissionItemList = null;
            for (int iIndex = 0; iIndex < GroupData.Length; iIndex++)
            {
                OPermissionItemList = new PermissionItemListCls();
                OPermissionItemList.ptc = GroupDataPermission.StaticId;
                OPermissionItemList.id = GroupData[iIndex].GroupDataId;
                OPermissionItemList.subject = GroupData[iIndex].GroupDataName;
                PermissionItemLists.Add(OPermissionItemList);
            }
            OPermissionItemList = new PermissionItemListCls();
            OPermissionItemList.ptc = GroupDataPermission.StaticId;
            OPermissionItemList.id = "Statitics";
            OPermissionItemList.subject = "Thống kê truy cập";
            PermissionItemLists.Add(OPermissionItemList);

            return PermissionItemLists;
        }
    }
}
